import marimo

__generated_with = "0.9.27"
app = marimo.App(width="medium")


@app.cell
def __():
    #2019

    sa_19 = [12646, 13070, 13160, 17875, 16360, 16345,
             16495, 16435, 16435, 18990, 16405, 16844,
             16000]

    # sa_19_sum = sum(sa_19)
    # sa_19_sum

    def sa_hour_paid_cal(sa_sum):
        return sa_sum/(12*21.75*8)

    sa_19_hour_paid = sa_hour_paid_cal(sum(sa_19))

    # 已休0，过年3*8
    ann_hour_19 = 56

    def ann_paid_cal(sa_hour_paid, ann_hour):
        return sa_hour_paid*2*ann_hour


    ann_paid_19 = ann_paid_cal(sa_19_hour_paid, ann_hour_19)
    sa_19_hour_paid, ann_hour_19, ann_paid_19
    return (
        ann_hour_19,
        ann_paid_19,
        ann_paid_cal,
        sa_19,
        sa_19_hour_paid,
        sa_hour_paid_cal,
    )


@app.cell
def __(ann_paid_cal, sa_hour_paid_cal):
    sa_20 = [17145, 16920, 17033, 19055, 16950, 17435, 
             20480, 17525, 17825, 17220, 17265, 17280, 
             28755]

    sa_20_hour_paid = sa_hour_paid_cal(sum(sa_20))

    #已休26，过年3*8
    ann_hour_20 = 30

    ann_paid_20 = ann_paid_cal(sa_20_hour_paid, ann_hour_20)
    sa_20_hour_paid, ann_hour_20, ann_paid_20
    return ann_hour_20, ann_paid_20, sa_20, sa_20_hour_paid


@app.cell
def __(ann_paid_cal, sa_hour_paid_cal):
    sa_21 = [19959, 20186, 19444, 20079, 20519, 20059,
             20139, 21599, 21139, 21019, 21039, 21119,
             18979]

    #已休20，过年3*8
    ann_hour_21 = 36

    sa_21_hour_paid = sa_hour_paid_cal(sum(sa_21))
    ann_paid_21 = ann_paid_cal(sa_21_hour_paid, ann_hour_21)
    sa_21_hour_paid, ann_hour_21, ann_paid_21
    return ann_hour_21, ann_paid_21, sa_21, sa_21_hour_paid


@app.cell
def __(ann_paid_cal, sa_hour_paid_cal):
    sa_22 = [21468, 21388, 21368, 31513, 22748, 21508,
             22488, 19928, 21508, 19928, 19968, 19948,
             22948]


    #80-15.5-24
    #已休15.5，过年3*8
    ann_hour_22 = 40.5

    sa_22_hour_paid = sa_hour_paid_cal(sum(sa_22))
    ann_paid_22 = ann_paid_cal(sa_22_hour_paid, ann_hour_22)
    sa_22_hour_paid, ann_hour_22, ann_paid_22
    return ann_hour_22, ann_paid_22, sa_22, sa_22_hour_paid


@app.cell
def __(ann_paid_cal, sa_hour_paid_cal):
    sa_23 = [19627, 20348, 19232, 21968, 23397, 24048,
            22048, 22088, 22068, 20408, 20608, 20568,]

    #已休1，过年3*8
    ann_hour_23 = 55

    sa_23_hour_paid = sa_hour_paid_cal(sum(sa_23))
    ann_paid_23 = ann_paid_cal(sa_23_hour_paid, ann_hour_23)
    sa_23_hour_paid, ann_hour_23, ann_paid_23
    return ann_hour_23, ann_paid_23, sa_23, sa_23_hour_paid


@app.cell
def __(ann_paid_cal):
    sa_24 = [9964,
            23428, 20308, 20488, 20508, 23855, 20428,
            20508, 20468, 20468,20428]


    #已休0，过年3*8
    a = round(80*11/12)
    ann_hour_24 = a-24

    # ann_hour_24

    # 24年10个月工资
    def sa_hour_paid_cal_x(sa_sum):
        return sa_sum/(10*21.75*8)


    sa_24_hour_paid = sa_hour_paid_cal_x(sum(sa_24))
    ann_paid_24 = ann_paid_cal(sa_24_hour_paid, ann_hour_24)
    sa_24_hour_paid, ann_hour_24, ann_paid_24
    return (
        a,
        ann_hour_24,
        ann_paid_24,
        sa_24,
        sa_24_hour_paid,
        sa_hour_paid_cal_x,
    )


@app.cell
def __():
    import marimo as mo


    n = mo.ui.slider(start=6, step=0.5, stop=12,label='补偿金n: ')
    n
    return mo, n


@app.cell
def __(n):
    #23年11-24年10



    sa_p12 = [20608, 20568, 

         #24年
         23428, 20308, 20488, 20508, 23855, 20428, 
         20508, 20468, 20468, 20428,

         #年终奖
         9665,

         # 其他
         # 1228.14, 224.11, 99, 1041.28, 178.35, 177.99, 562.26, 514.15, 3000, 791.38, 9665.26, 590, 968.36, 353, 976.09, 987.44, 900, 777.83, 900, 201.97, 684.86, 31, 355, 477, 965.13, 839.53, 62.33, 340
         ]


    sa_base = sum(sa_p12)/12

    sa_base




    # 12*sa_base

    compensation = n.value*sa_base
    compensation
    return compensation, sa_base, sa_p12


@app.cell
def __(
    ann_paid_19,
    ann_paid_20,
    ann_paid_21,
    ann_paid_22,
    ann_paid_23,
    ann_paid_24,
):
    9665*3

    # # 23年未发年终
    # ann_23_p = 9665

    # # 24年应发年终
    # ann_24 = 9665*2


    # sum_1 = 9*sa_base+ann_23_p+ann_24
    # sum_1


    ann_payment = ann_paid_19+ann_paid_20+ann_paid_21+ann_paid_22+ann_paid_23+ann_paid_24
    # sum_1+ann_paid_19+ann_paid_20+ann_paid_21+ann_paid_22+ann_paid_23+ann_paid_24

    ann_payment

    ann_payment_1 = ann_paid_19+ann_paid_20+ann_paid_21+ann_paid_22+ann_paid_23
    # sum_1+ann_paid_19+ann_paid_20+ann_paid_21+ann_paid_22+ann_paid_23+ann_paid_24

    ann_payment_1
    return ann_payment, ann_payment_1


@app.cell
def __():
    ann_bonus_23 = 9665
    ann_bonus_24 = 9665 * 2


    ann_bonus_24
    return ann_bonus_23, ann_bonus_24


@app.cell
def __(ann_bonus_23, ann_bonus_24, ann_payment, compensation):
    total_sum = compensation+ ann_payment + ann_bonus_23 + ann_bonus_24
    total_sum
    return (total_sum,)


@app.cell
def __():
    lowest_pay = 2490

    lowest_pay*12
    return (lowest_pay,)


@app.cell
def __():
    218100+28995+51806
    return


@app.cell
def __():
    # 社保计算


    # # 公司比率
    # _ab = round(0.2 + 0.12 + 0.02 + 0.006 + 0.02, 3)
    # _ab


    # #个人比率
    # _ad = 0.11

    # # 倍数
    # _ae = _ab/_ad

    # # 24年公司每月缴纳
    # _af = 493.5*_ae





    def company_insure(person_insure):
        # 公司比率
        _ab = round(0.2 + 0.12 + 0.02 + 0.006 + 0.02, 3)
        #个人比率
        _ad = 0.11
        return person_insure*(_ab/_ad)

    # print(_af)

    # print(company_insure(493.5))






    # 24年工资,
    _sa_24 = [23428, 20308, 20488, 20508, 23855, 20428,
             20508, 20468, 20468, 20428]

    company_insure_val = company_insure(493.5)


    # def calculate_average(numbers):
    #     if not numbers:
    #         return 0
    #     return sum(numbers) / len(numbers)

    # # 平均工资
    # _ac = calculate_average(_sa_24)


    # # 平均工资应缴社保
    # _ac*_ab

    # # 平均工资未缴社保
    # _ac*_ab -_af
    # _af





    def requre_insure(sal_list, company_insure_val):
        # 平均工资
        _ac = sum(sal_list) / len(sal_list)

        return _ac*round(0.2 + 0.12 + 0.02 + 0.006 + 0.02, 3)-company_insure_val


    # 平均工资未缴社保
    insu_24 = requre_insure(_sa_24, company_insure_val)




    _sa_23 = [19627, 20348, 19232, 21968, 23397, 24048,
            22048, 22088, 22068, 20408, 20608, 20568,]

    _ag_23 = 493.5

    com_insu_23 = company_insure(_ag_23)

    # 平均工资未缴社保
    insu_23 = requre_insure(_sa_23, com_insu_23)




    _sa_22 = [21468, 21388, 21368, 31513, 22748, 21508,
             22488, 19928, 21508, 19928, 19968, 19948]

    _ag_22 = 472.5

    com_insu_22 = company_insure(_ag_22)
    insu_22 = requre_insure(_sa_22,com_insu_22)

    insu_22



    _sa_21 = [19959, 20186, 19444, 20079, 20519, 20059,
             20139, 21599, 21139, 21019, 21039, 21119,]

    _ag_21 = 472.5

    com_insu_21 = company_insure(_ag_21)
    insu_21 = requre_insure(_sa_21,com_insu_21)

    insu_21


    _sa_20 = [17145, 16920, 17033, 19055, 16950, 17435, 
             20480, 17525, 17825, 17220, 17265, 17280]

    _ag_20 = 411.81

    com_insu_20 = company_insure(_ag_20)
    insu_20 = requre_insure(_sa_20,com_insu_20)

    insu_20


    _sa_19 = [12646, 13070, 13160, 17875, 16360, 16345,
             16495, 16435, 16435, 18990, 16405, 16844]

    _ag_19 = 411.81

    com_insu_19 = company_insure(_ag_19)
    insu_19 = requre_insure(_sa_19,com_insu_19)

    insu_19


    insu_l = [insu_19, insu_20, insu_21, insu_22, insu_23, insu_24]

    12*sum(insu_l)
    return (
        com_insu_19,
        com_insu_20,
        com_insu_21,
        com_insu_22,
        com_insu_23,
        company_insure,
        company_insure_val,
        insu_19,
        insu_20,
        insu_21,
        insu_22,
        insu_23,
        insu_24,
        insu_l,
        requre_insure,
    )


@app.cell
def __():
    # 19-23未休年假工资



    _ab = [11106,6922,9147,11122,13508]

    sum(_ab)
    return


@app.cell
def __():
    2490*12
    return


if __name__ == "__main__":
    app.run()
